

export let title_set = ["以更加开放的姿态拥抱世界","新版标准地图上线！规范使用地图，一点都不能错","午睡和不午睡的人，长期下来有什么区别？","腾冲温泉SPA","西双版纳泼水节活动","香格里拉－迪庆3日游","大理－丽江－梅里雪山","石林奇观","澄江烧烤晚会"]
export let username_set = ["Jo Developer","黑老头","野牛","清风","子皓","葫芦侠","vim","鸟叔","同哥"]
export let thumbs_set = [
    "http://page.firstvar.com/media/img/0000000001.jpg",
    "http://page.firstvar.com/media/img/0000000002.jpg",
    "http://page.firstvar.com/media/img/0000000003.jpg",
    "http://page.firstvar.com/media/img/0000000004.jpg",
    "http://page.firstvar.com/media/img/0000000005.jpg",
    "http://page.firstvar.com/media/img/0000000006.jpg",
    "http://page.firstvar.com/media/img/0000000007.jpg",
    "http://page.firstvar.com/media/img/0000000008.jpg",
    "http://page.firstvar.com/media/img/0000000009.jpg",
    "http://page.firstvar.com/media/img/0000000010.jpg",
    "http://page.firstvar.com/media/img/0000000011.jpg",
    "http://page.firstvar.com/media/img/0000000012.jpg",
    "http://page.firstvar.com/media/img/0000000013.jpg",
    "http://page.firstvar.com/media/img/0000000014.jpg",
    "http://page.firstvar.com/media/img/0000000015.jpg",
    "http://page.firstvar.com/media/img/0000000016.jpg",
    "http://page.firstvar.com/media/img/0000000017.jpg",
    "http://page.firstvar.com/media/img/0000000019.jpg",
    "http://page.firstvar.com/media/img/0000000020.jpg",
    "http://page.firstvar.com/media/img/0000000021.jpg",
    "http://page.firstvar.com/media/img/0000000022.jpg",
    "http://page.firstvar.com/media/img/0000000023.jpg",
    "http://page.firstvar.com/media/img/0000000024.jpg",
];

export let avatar_set = [
    "http://page.firstvar.com/media/avatar/avatar1.jpg",
    "http://page.firstvar.com/media/avatar/avatar2.jpg",
    "http://page.firstvar.com/media/avatar/avatar3.jpg",
    "http://page.firstvar.com/media/avatar/avatar4.png",
    "http://page.firstvar.com/media/avatar/avatar5.jpg",
    "http://page.firstvar.com/media/avatar/avatar6.jpg",
    "http://page.firstvar.com/media/avatar/avatar7.jpg",
    "http://page.firstvar.com/media/avatar/avatar8.jpg",
    "http://page.firstvar.com/media/avatar/avatar9.jpg",
    "http://page.firstvar.com/media/avatar/avatar10.jpg",

];


export class Gen {

    static get item(){
        return {
            avatar:Gen.avatar,
            username:Gen.name,
            title:Gen.title,
            content:Gen.text(10),
            thumb:Gen.img,
            id:Gen.ID(12),
        }
    }

    static items(len=10){
        let ls = [];
        for (let i = 0; i < len; i++) {
            ls.push(Gen.item)
        }
        return ls;
    }



    static get img(){
        let data = thumbs_set;

        let n =  Math.floor(Math.random()*data.length);
        return data[n];
    }
    static get title(){
        let data = title_set;
        let n =  Math.floor(Math.random()*data.length);
        return data[n];
    }

    static get name(){
        let data = username_set;
        let n =  Math.floor(Math.random()*data.length);
        return data[n]
    }

    static get avatar(){
        let data =  avatar_set;
        let n =  Math.floor(Math.random()*data.length);
        return data[n]
    }


    static number(len = 2){
        const $chars = '1234567890';
        const maxPos = $chars.length;
        let str = '';
        for (let i = 0; i < len; i++) {
            str += $chars.charAt(Math.floor(Math.random() * maxPos));
        }
        return str;
    }




    static chars(len = 8){
        const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
        const maxPos = $chars.length;
        let str = '';
        for (let i = 0; i < len; i++) {
            str += $chars.charAt(Math.floor(Math.random() * maxPos));
        }
        return str;
    }

    static ID(len = 12){
        return Gen.chars(2).toUpperCase() + Gen.number(len-2);
    }


    static text(count){
        let n =  Math.floor(Math.random()*count);

        let txt = Gen.title;
        while(n > 0){
            txt = txt + Gen.title;
            n = n - 1;
        }
        return txt;

    }

    static getRandomStr(len = 32) {
        const $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
        const maxPos = $chars.length;
        let str = '';
        for (let i = 0; i < len; i++) {
            str += $chars.charAt(Math.floor(Math.random() * maxPos));
        }
        return str;
    };


}

